package com.xqls.server.dto.send;

import com.xqls.server.dto.SoketCommonDto;
import com.xqls.server.netty.DecoderUtil;
import io.netty.buffer.ByteBuf;
import org.apache.log4j.Logger;

/**
 * 即时单次采样
 * Created by 17936 on 2017/5/4.
 */
public class SingleSampleSamplingSetDto extends SoketCommonDto {
    private static Logger logger = Logger.getLogger(SoketCommonDto.class);



    /**
     * 采样模式：即时单次采样
     */
    public static  final  String SINGLE_SAMPLE_IMMEDIATELY="0007";
    /**
     * 采样量
     */
    private Integer singleSamplingQuantity;

    /**
     * 采样瓶号
     * @return
     */
    private Integer samplingBottle;

    public Integer getSamplingBottle() {
        return samplingBottle;
    }

    public void setSamplingBottle(Integer samplingBottle) {
        this.samplingBottle = samplingBottle;
    }

    public Integer getSingleSamplingQuantity() {
        return singleSamplingQuantity;
    }

    public void setSingleSamplingQuantity(Integer singleSamplingQuantity) {
        this.singleSamplingQuantity = singleSamplingQuantity;
    }



    public Integer getLength(){
        return 26;
    }
    public String getCode() {
        return "ca";
    }

    public void encode(ByteBuf byteBuf) {
        byteBuf.writeBytes(DecoderUtil.hexStringToBytes("0007"));
        DecoderUtil.integerToBytes(this.getSamplingBottle(),byteBuf,2);
        byteBuf.writeBytes(DecoderUtil.hexStringToBytes("00000000"));
        DecoderUtil.integerToBytes(this.getSingleSamplingQuantity(),byteBuf,4);
        byteBuf.writeBytes(DecoderUtil.hexStringToBytes("00000000000000000000"));
        super.encode(byteBuf);
    }
}
